import { http } from "@/utils/http";
import { ChartModel, PageResponse } from "@/api/model/baseModel";
import { LoginLog, OperateLog } from "@/api/model/logModel";

enum Api {
  OperateLogList = "/log/operate",
  LoginLogList = "/log/login",
  currentLogin = "/log/currentLogin",
  userLoginRank = "/log/userLoginRank",
  userLoginRegionRank = "/log/userLoginRegionRank",
  apiAccessRank = "/log/apiAccessRank",
}

export function getOperateLogList(param: OperateLog) {
  return http.get<PageResponse<OperateLog>>({
    url: Api.OperateLogList,
    params: param,
  });
}
export function getLoginLogList(param: LoginLog) {
  return http.get<PageResponse<LoginLog>>({
    url: Api.LoginLogList,
    params: param,
  });
}
export function getCurrentLogin() {
  return http.get<LoginLog[]>({
    url: Api.currentLogin,
  });
}
export function userLoginRank() {
  return http.get<ChartModel[]>({
    url: Api.userLoginRank,
  });
}
export function userLoginRegionRank() {
  return http.get<ChartModel[]>({
    url: Api.userLoginRegionRank,
  });
}
export function apiAccessRank() {
  return http.get<ChartModel[]>({
    url: Api.apiAccessRank,
  });
}
